import Main from '@/view/main/main.vue'

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
	path: '/login',
	name: 'login',
	meta: {
		title: 'Login - 登录'
	},
	component: resolve => {
		require(['@/view/login/login.vue'], resolve)
	}
}

export const page404 = {
	path: '/*',
	name: 'error-404',
	meta: {
		title: '404-页面不存在'
	},
	component: resolve => {
		require(['@/view/error-page/404.vue'], resolve)
	}
}

export const page403 = {
	path: '/403',
	meta: {
		title: '403-权限不足'
	},
	name: 'error-403',
	component: resolve => {
		require(['@/view/error-page/403.vue'], resolve)
	}
}

export const page500 = {
	path: '/500',
	meta: {
		title: '500-服务端错误'
	},
	name: 'error-500',
	component: resolve => {
		require(['@/view/error-page/500.vue'], resolve)
	}
}

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
	path: '/',
	name: 'otherRouter',
	redirect: '/home',
	component: Main,
	children: [{
		path: 'form',
		title: {
			i18n: 'form'
		},
		name: 'form',
		component: resolve => {
			require(['@/view/form/form.vue'], resolve)
		}
	}]
}

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
	{
		path: '/components',
		name: 'components',
		title: '管理员控制台',
		meta: {
			icon: 'ios-game-controller-a-outline'
		},
		component: Main,
		children: [{
				path: '/getNsall',
				name: 'getNsall',
				title: '命名空间列表',
				component: () => import('@/view/control/getNsall.vue')
			},
			{
				path: '/podList',
				name: 'podList',
				title: '实例列表',
				component: () => import('@/view/control/podList.vue')
			},
			{
				path: '/Mirror',
				name: 'Mirror',
				title: '镜像',
				component: () => import('@/view/control/Mirror.vue')
			},
			{
				path: '/userManager',
				name: 'userManager',
				title: '用户管理',
				component: () => import('@/view/control/userManager.vue')
			},
			{
				path: '/menu',
				name: 'menu',
				title: '菜单管理',
				component: () => import('@/view/control/menu.vue')
			},
			{
				path: '/generation',
				name: 'generation',
				title: '自动生成',
				component: () => import('@/view/control/generation.vue')
			},
			{
				path: '/role',
				name: 'role',
				title: '角色管理',
				component: () => import('@/view/control/role.vue')
			},
			{
				path: '/appDetails/:type/:group/:name',
				name: 'appDetails',
				title: '详情',
				component: () => import('@/view/control/appDetails.vue')
			},
			{
				path: '/deploy',
				name: 'deploy',
				title: '部署',
				component: () => import('@/view/control/deploy.vue')
			},
			{
				path: '/copy',
				name: 'copy',
				title: '副本集',
				component: () => import('@/view/control/copy.vue')
			},
			{
				path: '/copyDetails',
				name: 'copyDetails',
				title: '副本集详情',
				component: () => import('@/view/control/copyDetails.vue')
			},
			{
				path: '/appServer',
				name: 'appServer',
				title: '服务',
				component: () => import('@/view/control/server.vue')
			},
			{
				path: '/appServerDetails',
				name: 'appServerDetails',
				title: '服务详情',
				component: () => import('@/view/control/serverDetails.vue')
			},
			{
				path: '/pod',
				name: 'pod',
				title: '容器',
				component: () => import('@/view/control/pod.vue')
			},
			{
				path: '/podDetails',
				name: 'podDetails',
				title: '容器详情',
				component: () => import('@/view/control/podDetails.vue')
			},
			{
				path: '/storage',
				name: 'storage',
				title: '持久化存储',
				component: () => import('@/view/control/storage.vue')
			},
			{
				path: '/statement',
				name: 'statement',
				title: '持久化存储卷声明',
				component: () => import('@/view/control/statement.vue')
			},
			{
				path: '/storageClass',
				name: 'storageClass',
				title: '存储类',
				component: () => import('@/view/control/storageClass.vue')
			},
			{
				path: '/appRole',
				name: 'appRole',
				title: '角色',
				component: () => import('@/view/control/appRole.vue')
			},
			{
				path: '/creat',
				name: 'creat',
				title: '创建',
				component: () => import('@/view/control/creat.vue')
			},
			{
				path: '/record',
				name: 'record',
				title: '创建记录',
				component: () => import('@/view/control/record.vue')
			},
			{
				path: '/router',
				name: 'router',
				title: '配置路由',
				component: () => import('@/view/control/router.vue')
			}
		]
	},
	{
		path: '/Application',
		name: 'Application',
		title: '应用管理',
		meta: {
			icon: 'ios-apps'
		},
		component: Main,
		children: [
			{
				path: '/application',
				name: 'application',
				title: '总览',
				redirect: '/applicationHome',
				component: () => import('@/view/application/index.vue'),
				children: [
					{
						path: '/applicationHome',
						name: 'applicationHome',
						title: '总览',
						component: () => import('@/view/application/home.vue')
					},
					{
						path: '/applicationMonitor',
						name: 'applicationMonitor',
						title: '监控',
						component: () => import('@/view/application/monitor.vue')
					},
					{
						path: '/applicationLog',
						name: 'applicationLog',
						title: '日志',
						component: () => import('@/view/application/log.vue')
					},
					{
						path: '/applicationPort',
						name: 'applicationPort',
						title: '端口',
						component: () => import('@/view/application/port.vue')
					},
					{
						path: '/applicationFlex',
						name: 'applicationFlex',
						title: '伸缩',
						component: () => import('@/view/application/flex.vue')
					},
					{
						path: '/applicationRely',
						name: 'applicationRely',
						title: '依赖',
						component: () => import('@/view/application/rely.vue')
					},
					{
						path: '/applicationStorage',
						name: 'applicationStorage',
						title: '存储',
						component: () => import('@/view/application/storage.vue')
					},
					{
						path: '/applicationPlug',
						name: 'applicationPlug',
						title: '插件',
						component: () => import('@/view/application/plug.vue')
					},
					{
						path: '/applicationSet',
						name: 'applicationSet',
						title: '设置',
						component: () => import('@/view/application/set.vue')
					}
				]
			},
			{
				path: '/applicationList',
				name: 'applicationList',
				title: '应用列表',
				component: () => import('@/view/application/list.vue')
			}
		]
	},
	{
		path: '/replyList',
		name: 'replyList',
		title: '工单回复',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/all',
				name: 'all',
				title: '未解决的工单',
				component: () => import('@/view/reply/allList.vue')
			},
			{
				path: '/alled',
				name: 'alled',
				title: '已解决的工单',
				component: () => import('@/view/reply/allListed.vue')
			},
			{
				path: '/replylist/:workcode/:uid',
				name: 'replylist',
				title: '',
				component: () => import('@/view/reply/replyList.vue')
			},
			{
				path: '/complaints',
				name: 'complaints',
				title: '投诉意见',
				component: () => import('@/view/reply/complaints.vue')
			},
			{
				path: '/dispose/:workcode/:status',
				name: 'dispose',
				title: '',
				component: () => import('@/view/reply/dispose.vue')
			}
		]
	},
	{
		path: '/Edit',
		name: 'Edit',
		title: '编辑中心',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [
			{
				path: '/edit',
				name: 'edit',
				title: '文章编辑',
				component: () => import('@/view/edit/edit.vue')
			},
			{
				path: '/product',
				name: 'product',
				title: '文章编辑',
				component: () => import('@/view/edit/product.vue')
			},
			{
				path: '/dictionary',
				name: 'dictionary',
				title: '数据字典',
				component: () => import('@/view/edit/dictionary.vue')
			},
			{
				path: '/supply',
				name: 'supply',
				title: '供应平台',
				component: () => import('@/view/edit/supply.vue')
			},
			{
				path: '/demand',
				name: 'demand',
				title: '需求平台',
				component: () => import('@/view/edit/demand.vue')
			}
		]
	},
	{
		path: '/Journal',
		name: 'Journal',
		title: '运维日志',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
			path: '/journal',
			name: 'journal',
			title: '运维日志',
			component: () => import('@/view/journal/journal.vue')
		}]
	},
	{
		path: '/alarmSetting',
		name: 'alarmSetting',
		title: '监控警报',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/AlarmSetting',
				name: 'AlarmSetting',
				title: '监控警报',
				component: () => import('@/view/AlarmSetting/AlarmSetting.vue')
			},
			{
				path: '/AlarmList',
				name: 'AlarmList',
				title: '报警列表',
				component: () => import('@/view/AlarmSetting/AlarmList.vue')
			}
		]
	},
	{
		path: '/Resources',
		name: 'Resources',
		title: '资源管理',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/resources',
				name: 'resources',
				title: '资源管理',
				component: () => import('@/view/resources/resources.vue')
			},
			{
				path: '/details',
				name: 'details',
				title: '资源管理-详情',
				component: () => import('@/view/resources/details.vue')
			}
		]
	},
	{
		path: '/server',
		name: 'server',
		title: '服务器监控',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/home',
				name: 'home',
				title: '总览',
				component: () => import('@/view/server/index.vue')
			},
			{
				path: '/server_list',
				name: 'server_list',
				title: '服务器列表',
				component: () => import('@/view/server/server_list.vue')
			},
			{
				path: '/server_group',
				name: 'server_group',
				title: '服务器分组',
				component: () => import('@/view/server/server_group.vue')
			},
			{
				path: '/server_bind',
				name: 'server_bind',
				title: '未绑定服务器列表',
				component: () => import('@/view/server/server_bind.vue')
			}
		]
	},
	{
		path: '/personal',
		name: 'personal',
		title: '个人中心',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/Personal',
				name: 'Personal',
				title: '个人中心',
				component: () => import('@/view/Personal/Personal.vue')
			},
			{
				path: '/enterprise',
				name: 'enterprise',
				title: '企业中心',
				component: () => import('@/view/Personal/enterprise.vue')
			}
		]
	},
	{
		path: '/OrderList',
		name: 'OrderList',
		title: '订单中心',
		meta: {
			icon: 'ios-chatbubbles',
			hideInMenu: true
		},
		component: Main,
		children: [{
				path: '/orderList',
				name: 'orderList',
				title: '个人中心',
				component: () => import('@/view/order/list.vue')
			},
			{
				path: '/orderListed',
				name: 'orderListed',
				title: '企业中心',
				component: () => import('@/view/order/listed.vue')
			}
		]
	}
]

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
	loginRouter,
	otherRouter,
	...appRouter,
	page500,
	page403,
	page404
]
